package cn.wolfcode.luowowo.util;

import cn.wolfcode.luowowo.QueryObject.StrategyCommentQuery;
import cn.wolfcode.luowowo.QueryObject.TravelCommentQuery;
import cn.wolfcode.luowowo.domain.StrategyComment;
import cn.wolfcode.luowowo.domain.TravelComment;
import cn.wolfcode.luowowo.exception.LogicException;
import cn.wolfcode.luowowo.service.IStrategyCommentService;
import cn.wolfcode.luowowo.service.ITravelCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 评论查询工具类
 */
public abstract class CommentQueryUtil {
    //攻略评论查询
    public static Page<StrategyComment> StrategyCommentQueryByStrategyId
            (String strategyId, IStrategyCommentService strategyCommentService) {

        StrategyCommentQuery qo = new StrategyCommentQuery();
        qo.setStrategyId(strategyId);
        Page<StrategyComment> page = strategyCommentService.query(qo);
        return page;
    }
    //游记评论查询
    public static Page<TravelComment> TravelCommentQueryByStrategyId
            (String travelId, ITravelCommentService travelCommentService) {

        TravelCommentQuery qo = new TravelCommentQuery();
        qo.setTravelId(travelId);
        qo.setPageSize(Integer.MAX_VALUE);
        Page<TravelComment> page = travelCommentService.query(qo);
        return page;
    }
}